<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>calc()</title>
<meta name="description" content="CSS3参考手册之: calc()" />
<meta name="keywords" content="calc(), css3取值, css3, css3参考手册" />
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<meta name="robots" content="all" />
<!--[if lte IE 8]>
<script src="../../js/html5.js"></script>
<![endif]-->
<link rel="stylesheet" href="../../skin/article.css" />
</head>
<body>
<nav id="guide" class="g-mod">
	<div class="from">
		<a href="http://css.doyoe.com/" target="_blank">CSS3参考手册</a>
		<span>&#187;</span>
		<a href="../index.htm">取值与单位列表</a>
		<span>&#187;</span>
		<a href="index.htm" id="category" rel="values/functional" name="calc()">函数值</a>
		<span>&#187;</span>
	</div>
	<div class="to">
		<span class="label">相关内容：</span>
		<div class="g-combobox g-transition">
			<a href="?" class="g-transition target">
				<strong>其它函数值参考</strong>
				<span>选择其它项<!--[if lte IE 7]><ins>IE7 and earlier, Get to die</ins><![endif]--></span>
			</a>
			<div class="g-transition list">
				<ul>
					<!-- 插入分类快速导航 -->
				</ul>
			</div>
		</div>
	</div>
</nav>
<header id="hd">
	<section id="title" class="g-mod">
		<h1 class="tit">calc()</h1>
		<ul class="info">
			<li><strong>版本：CSS3</strong></li>
		</ul>
		<!-- 插入浏览器信息 -->
	</section>
</header>
<section id="bd">
	<section class="g-mod g-attr" id="syntax">
		<h2 class="tit">语法：</h2>
		<div class="cont">
			<p><strong>calc()</strong> = calc(四则运算)</p>
		</div>
	</section>
	<section id="intro" class="g-mod g-attr">
		<h2 class="tit">说明：</h2>
		<div class="cont">
			<strong>用于动态计算长度值。</strong>
			<ul>
				<li class="g-color-light">需要注意的是，运算符前后都需要保留一个空格，例如：<code class="incode">width: calc(100% - 10px)</code>；</li>
				<li>任何长度值都可以使用calc()函数进行计算；</li>
				<li>calc()函数支持 "+", "-", "*", "/" 运算；</li>
				<li>calc()函数使用标准的数学运算优先级规则；</li>
			</ul>
		</div>
	</section>
	<section id="compatible" class="g-mod g-attr">
		<h2 class="tit">兼容性：</h2>
		<div class="cont">
			<ul class="support-type">
				<li><span class="support">浅绿</span> = 支持</li>
				<li><span class="unsupport">红色</span> = 不支持</li>
				<li><span class="partsupport">粉色</span> = 部分支持</li>
			</ul>
			<table class="g-data">
				<thead>
					<tr>
						<th>IE</th>
						<th>Firefox</th>
						<th>Chrome</th>
						<th>Safari</th>
						<th>Opera</th>
						<th>iOS Safari</th>
						<th>Android Browser</th>
						<th>Android Chrome</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td class="unsupport">6.0-8.0</td>
						<td class="unsupport">2.0-3.6</td>
						<td class="unsupport">4.0-18.0</td>
						<td class="unsupport">3.1-5.1</td>
						<td class="support" rowspan="3">15.0+</td>
						<td class="unsupport">3.2-5.1</td>
						<td class="unsupport">2.1-4.3</td>
						<td class="unsupport">18.0</td>
					</tr>
					<tr>
						<td class="partsupport">9.0 <sup><a href="#support1">#1</a></sup></td>
						<td class="support">4.0-15.0<br /><sup class="fix">-moz-</sup></td>
						<td class="support">19.0-25.0<br /><sup class="fix">-webkit-</sup></td>
						<td class="support">6.0<br /><sup class="fix">-webkit-</sup></td>
						<td class="support">6.0-6.1<br /><sup class="fix">-webkit-</sup></td>
						<td class="partsupport" rowspan="2">4.4-4.4.4 <sup><a href="#support2">#2</a></sup></td>
						<td class="support">19.0-25.0<br /><sup class="fix">-webkit-</sup></td>
					</tr>
					<tr>
						<td class="support">10.0+</td>
						<td class="support">16.0+</td>
						<td class="support">26.0+</td>
						<td class="support">6.1+</td>
						<td class="support">7.0+</td>
						<td class="support">26.0+</td>
					</tr>
				</tbody>
			</table>
			<ol class="support-info">
				<li id="support1">当在 <a href="../../properties/background/background-position.htm" class="g-property">background-position</a>中使用<code class="g-code">calc()</code>时将会导致浏览器崩溃；</li>
				<li id="support2">部分版本在使用<code class="g-code">calc()</code>时，乘法和除法可能无效；</li>
			</ol>
		</div>
	</section>
	<section class="g-mod g-attr" id="example">
		<h2 class="tit">示例：</h2>
		<div class="cont">
			<textarea rows="10" cols="90">
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8" />
<title>calc()函数_CSS参考手册_web前端开发参考手册系列</title>
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<style>
.test {
	width: calc(100% - 50px);
	background: #eee;
}
</style>
</head>
<body>
<div class="test">我的宽度为100% - 50px</div>
</body>
</html>
			</textarea>
			<p><input type="button" value="运行" class="g-btn g-btn-sure" /></p>
		</div>
	</section>
</section>
<footer id="ft">
	<aside id="rights" class="g-mod">
		<!-- 插入浏览器及版权信息 -->
	</aside>
</footer>
<script src="../../js/jquery.js"></script>
<script src="../../js/inner.js"></script>
</body>
</html>